import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const state = {
  isNavShow:true  //状态中定义变量
}
const getters = {  // vuex计算属性
  showNav(state) {
    return state.isNavShow
  }
}
const actions ={ //action 用于管理和提交mutation
  SHOWNAV({commit}){  //显示
    commit('SHOWNAV')
  },
  HIDENAV({commit}){  //隐藏
    commit('HIDENAV')
  }
}
const mutations = {
  SHOWNAV(state){
    state.isNavShow = true;
  },
  HIDENAV(state){
    state.isNavShow = false;
  }
}
export default new Vuex.Store({
  state,
  getters,
  actions,
  mutations
})
